// Copyright (c) Microsoft Corporation.  All rights reserved.

using Microsoft.WindowsAPICodePack.DirectX.DXGI;
using System;

namespace EnumAdapters
{
    class Program
    {
        static void Main(string[] args)
        {
            DXGIFactory factory = DXGIFactory.CreateFactory();

            Console.WriteLine("Adapter(s) Information:");
            foreach (Adapter adapter in factory.GetAdapters())
            {
                AdapterDescription description = adapter.GetDescription();

                Console.WriteLine("Description: {0} ", description.Description);
                Console.WriteLine("\tDedicated System Memory: {0} ", description.DedicatedSystemMemory);
                Console.WriteLine("\tDedicated Video Memory: {0} ", description.DedicatedVideoMemory);
                Console.WriteLine("\tLuid: {0:X}:{1:X} ", description.AdapterLuid.HighPart, description.AdapterLuid.LowPart);
                Console.WriteLine("\tDevice Id: {0:X} ", description.DeviceId);
                Console.WriteLine("\tRevision: {0:X} ", description.Revision);

                Console.WriteLine("\tMonitor(s) Information:");
                foreach (Output output in adapter.GetOutputs())
                {
                    OutputDescription outDesc = output.GetDescription();

                    Console.WriteLine("\tDevice Name: {0} ", outDesc.DeviceName);
                    Console.WriteLine("\t\tAttached To Desktop?: {0} ", outDesc.AttachedToDesktop);
                    Console.WriteLine("\t\tRotation Mode: {0} ", outDesc.Rotation);
                    Console.WriteLine("\t\tMonitor Coordinates: {0},{1},{2},{3} ", outDesc.Monitor.MonitorCoordinates.left, outDesc.Monitor.MonitorCoordinates.top, outDesc.Monitor.MonitorCoordinates.right, outDesc.Monitor.MonitorCoordinates.bottom);
                    Console.WriteLine("\t\tWorking Coordinates: {0},{1},{2},{3} ", outDesc.Monitor.WorkCoordinates.left, outDesc.Monitor.WorkCoordinates.top, outDesc.Monitor.WorkCoordinates.right, outDesc.Monitor.WorkCoordinates.bottom);
                }
            }
        }
    }
}
